package com.efast.cafe.portal.bean.common;

import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

public class PortalUserDetails extends org.springframework.security.core.userdetails.User{

	 public PortalUserDetails(String username, String password, boolean enabled, boolean accountNonExpired,
			boolean credentialsNonExpired, boolean accountNonLocked,
			Collection<? extends GrantedAuthority> authorities) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
	}
	 
	 public PortalUserDetails(String username, String password, boolean enabled, boolean accountNonExpired,
				boolean credentialsNonExpired, boolean accountNonLocked,
				Collection<? extends GrantedAuthority> authorities,PortalUserSecurityBean user) {
			super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
			this.user = user;
		}

	/**
	 * 
	 */
	private static final long serialVersionUID = -4611587073271891500L;
	protected static final GrantedAuthority DEFAULT_USER_ROLE = new SimpleGrantedAuthority("ROLE_USER");
		private PortalUserSecurityBean user;
		
		

		
		
		

		@Override
		public String getPassword() {
			// TODO Auto-generated method stub
			return user.getPwd();
		}

		@Override
		public String getUsername() {
			// TODO Auto-generated method stub
			return user.getUsername();
		}

		@Override
		public boolean isAccountNonExpired() {
			// TODO Auto-generated method stub
			return true;
		}

		@Override
		public boolean isAccountNonLocked() {
			// TODO Auto-generated method stub
			return true;
		}

		@Override
		public boolean isCredentialsNonExpired() {
			// TODO Auto-generated method stub
			return true;
		}

		@Override
		public boolean isEnabled() {
			// TODO Auto-generated method stub
			return true;
		}

		public PortalUserSecurityBean getUser() {
			return user;
		}

		public void setUser(PortalUserSecurityBean user) {
			this.user = user;
		}

		
}
